﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using BLToolkit.Data;
using BLToolkit.DataAccess;
using BLToolkit.Mapping;
using BLL.Repository;
using Enities;

namespace BLL
{
    public class LuuTruBCVP:ILuuTruBCVP
    {
       
        public DataTable DanhSach()
        {
            using (DbManager db = new DbManager())
            {
                DataTable table = db.SetSpCommand("DanhSachBCVP").ExecuteDataTable();
                return table;
            }
        }
        public void Them(BaoCaoVP bcvp)
        {
            using (DbManager db = new DbManager())
            {
                db.SetSpCommand("[Them_BCVP]",bcvp.MaDocGia, bcvp.TenDocGia, bcvp.NgayMuon, bcvp.NgayThucTra, bcvp.LyDoViPham, bcvp.HinhThucXuLy).ExecuteNonQuery();
            }
        }
        public void Sua(BaoCaoVP bcvp)
        {
            using (DbManager db = new DbManager())
            {
                db.SetSpCommand("[Sua_BCVP]", bcvp.MaDocGia, bcvp.TenDocGia, bcvp.NgayMuon, bcvp.NgayThucTra, bcvp.LyDoViPham, bcvp.HinhThucXuLy).ExecuteNonQuery();
            }
        }
        public DataTable TimKiem(int MaDocGia)
        {
            using (DbManager db = new DbManager())
            {
                DataTable table = db.SetSpCommand("TK_MaDG_BCVP",MaDocGia).ExecuteDataTable();
                return table;
            }
        }
    }
}
